package com.zixun.util;

import com.aliyun.oss.OSSClient;

import java.io.InputStream;

/**
 * Created by Swinglife on 16/8/1.
 */
public class OSSUtil {

    public final static String ACCESS_KEY_ID = "JQ4IyYw0AyZS4KQT";
    public final static String ACCESS_KEY_SECRET = "5yPhikWCALLxK29BLk0VWvbNgr3E7O";
    public final static String ENDPOINT = "http://oss-cn-hangzhou.aliyuncs.com";

    public static void uploadFileToOss(String fileName, InputStream inputStream){
        // 创建OSSClient实例
        OSSClient ossClient = new OSSClient(ENDPOINT, ACCESS_KEY_ID, ACCESS_KEY_SECRET);
        ossClient.putObject("zx-picture", fileName, inputStream);
        ossClient.shutdown();
    }
}
